package com.basic.business.finance.service.impl;

import com.basic.common.constant.CacheConstants;
import com.basic.common.core.redis.RedisCacheUtils;
import org.springframework.stereotype.Service;
import com.basic.common.core.service.impl.BaseServiceImpl;
import com.basic.business.finance.domain.TMoneyRules;
import com.basic.business.finance.service.ITMoneyRulesService;
import com.basic.business.finance.mapper.TMoneyRulesMapper;

import javax.annotation.Resource;

/**
 * 账单规则Service业务层处理
 *
 * @author zhaoxy_jn@163.com
 */
@Service
public class TMoneyRulesServiceImpl extends BaseServiceImpl<TMoneyRulesMapper,TMoneyRules> implements ITMoneyRulesService {

    @Resource
    private TMoneyRulesMapper tMoneyRulesMapper;

    @Override
    public void loadingCache() {
        // 清空缓存
        RedisCacheUtils.clearCache(CacheConstants.MONEY_RULES_REDIS_KEY + "*");
        // 加载缓存
        RedisCacheUtils.setCacheObject(CacheConstants.MONEY_RULES_REDIS_KEY, tMoneyRulesMapper.getNormalMoneyRules());
    }

    @Override
    public int updateStatusByIds(String[] ids, String status) {
        return tMoneyRulesMapper.updateStatusByIds(ids, status);
    }
}
